package org.domain.seam1.entity;

import javax.ejb.Remove;
import javax.ejb.Stateful;

import org.jboss.seam.annotations.Conversational;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.framework.EntityHome;

import org.domain.seam1.entity.Person;


@Name("personHome")
//@Conversational
//@Scope(ScopeType.CONVERSATION)
public class PersonHome extends EntityHome<Person> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1361181538133785505L;
	
	@RequestParameter
	Long personId;

	@Override
	public Object getId() {
		if (personId == null) {
			return super.getId();
		} else {
			return personId;
		}
	}

	/*
	 * Using the @Begin annotation, the long-running conversation is created
	 * even if the user navigates manually to a page of the wizard.
	 * (non-Javadoc)
	 * 
	 * @see org.jboss.seam.framework.EntityHome#create()
	 */
	@Override
	@Begin(join = true)
	public void create() {
		super.create();
	}

	@Override
	public String remove() {
		String res = super.remove();
		clearInstance();
		return res;
	}


}
